package cn.edu.neusoft.yuejian_02.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.jude.rollviewpager.RollPagerView;

import cn.edu.neusoft.yuejian_02.R;
import cn.edu.neusoft.yuejian_02.fragment.ActivityFragment;
import cn.edu.neusoft.yuejian_02.fragment.ClubListFragment;
import cn.edu.neusoft.yuejian_02.fragment.PersonFragment;
import cn.edu.neusoft.yuejian_02.fragment.PostFragment;
import cn.edu.neusoft.yuejian_02.fragment.TrainListFragment;
import cn.edu.neusoft.yuejian_02.library.TabItem;
import cn.edu.neusoft.yuejian_02.library.XFragmentTabHost;

public class HomeActivity extends AppCompatActivity {
    private RollPagerView rollPV = null;
    private XFragmentTabHost mTabHost;
    String[] mTabTitle = new String[] {"活动", "俱乐部", "培训", "晒图", "我"};
    int[] mImageResId = new int[] {R.drawable.sel_menu_home, R.drawable.sel_menu_club, R.drawable.sel_menu_train,
            R.drawable.sel_menu_post, R.drawable.sel_menu_me};
    Class[] mFragClass = new Class[] {ActivityFragment.class, ClubListFragment.class,
            TrainListFragment.class, PostFragment.class, PersonFragment.class};


    private void initTabHost() {

        mTabHost = (XFragmentTabHost) findViewById(android.R.id.tabhost);
        mTabHost.setup(this, getSupportFragmentManager(), R.id.relate_tab_content);
        mTabHost.setTabMode(XFragmentTabHost.TabMode.Ripple);
        mTabHost.setTextActiveColor(Color.WHITE);
        mTabHost.setTextInactiveColor(Color.GRAY);
//        mTabHost.setFrontColor(Color.RED);
//        mTabHost.setBehindColor(Color.GREEN);

        for (int i = 0; i < mFragClass.length; i++) {
            Bundle bundle = new Bundle();
            //bundle.putString(ActivityFragment.FRAG_KEY, mTabTitle[i]);
            mTabHost.addTabItem(new TabItem(mTabTitle[i], mImageResId[i]),
                    mFragClass[i], bundle);
        }
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);
        initTabHost();

    }


}
